var util = require('../../utils/utils.js');
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    currentTab:0,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    //获取手机高度
    this.setData({
      navH: app.globalData.navHeight
    })
 },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    var that = this;
    wx.request({
      url: app.globalData.url + 'getUserIntegralOrder',
      data: {
        userId: wx.getStorageSync("userId")
      },
      method: 'POST',
      header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
      success: function (res) {
        that.setData({
          order: res.data.data,
          productList: res.data.data.productList
        })

      },
      fail: function (err) {
      },
    })
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  goToOrder: function (e) {
    var orderId = e.currentTarget.dataset.id;
    var plist = '[{"productId":"' + e.currentTarget.dataset.productid + '","num":' + 1 + ',"price":' + e.currentTarget.dataset.price + ',"title":"' + e.currentTarget.dataset.title + '","thumbnailImage":"' + e.currentTarget.dataset.thumbnailimage + '","point":' + e.currentTarget.dataset.point + ',"seckillNum":' + 0 + '}]';
    console.info(plist);
    wx.navigateTo({
      url: '/pages/integralOrder/integralOrder?type=1&orderId=' + orderId + '&point=' + e.currentTarget.dataset.point + '&price=' + e.currentTarget.dataset.price + '&title=' + e.currentTarget.dataset.title + '&thumbnailImage=' + e.currentTarget.dataset.thumbnailimage + '&orderstatus=' + e.currentTarget.dataset.orderstatus + '&ordernumber=' + e.currentTarget.dataset.ordernumber + '&updatetime=' + e.currentTarget.dataset.updatetime + '+&opid=' + e.currentTarget.dataset.opid + '&trackingnumber=' + e.currentTarget.dataset.trackingnumber
    })
  },
  navBack: function () {
    wx.navigateBack({

    })
  },

})